home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / info / rtnews / rtnv6n1 < prev    next >
Encoding:
Text File  |  1994-10-16  |  74.5 KB  |  1,554 lines

  1.  _ __                 ______                         _ __
  2. ' )  )                  /                           ' )  )
  3.  /--' __.  __  ,     --/ __  __.  _. o ____  _,      /  / _  , , , _
  4. /  \_(_/|_/ (_/_    (_/ / (_(_/|_(__<_/ / <_(_)_    /  (_</_(_(_/_/_)_
  5.          /                               /|
  6.         '                               |/
  7.  
  8.             "Light Makes Right"
  9.  
  10.              January 27, 1993
  11.             Volume 6, Number 1
  12.  
  13. Compiled by Eric Haines, 3D/Eye Inc, 2359 Triphammer Rd, Ithaca, NY 14850
  14.     erich@eye.com
  15. All contents are copyright (c) 1993 by the individual authors
  16. Archive locations: anonymous FTP at princeton.edu (128.112.128.1)
  17.     /pub/Graphics/RTNews, wuarchive.wustl.edu:/graphics/graphics/RTNews,
  18.     and many others.
  19.  
  20. Contents:
  21.     Introduction
  22.     New People, New Places, etc
  23.     An Easily Implemented Ray Tracing Speedup, by Steve Worley
  24.     Color Storage, by Greg Ward
  25.     Bounding Areas for Ray/Polygon Intersection, by Steve Worley and
  26.         Eric Haines
  27.     Simple, Fast Triangle Intersection, by Chris Green and Steve Worley
  28.     Ray Tracing Roundup
  29.     Spectrum Overview, edited by Nick Fotis
  30.     Comments on the Glazing Trick, by Eric Haines
  31.     ==== Net cullings follow ===============================================
  32.     Announcing the ACM SIGGRAPH Online Bibliography Project, by Stephen Spencer
  33.     A Brief History of Blobby Modeling, by Paul Heckbert
  34.     Cool Raytracing Ideas, Karen Paik
  35.     Optical Effects and Accuracy, by Sam Uselton
  36.     Map Projections Reference Book, by Mike Goss
  37.     A Brief Review of Playmation, by Chris Williams
  38.     PV3D Quick Review, by David Anjo
  39.     Bounding Volumes (Sphere vs. Box), by Tom Wilson
  40.     Raytracing Swept Objects, by Mark Podlipec
  41.     Ray Transformation, by Kendall Bennett
  42.  
  43. -------------------------------------------------------------------------------
  44.  
  45. Introduction
  46.  
  47. This issue seems to have a theme of efficiency hacking.  It's interesting to
  48. note that there are still many "engineering" details which have not been worked
  49. out (or at least are not commonly available).  Some of the articles here talk
  50. about ways to polish common algorithms (bounding volume testing, polygon
  51. testing) that makes them noticeably faster.
  52.  
  53. On a related note, recently I received a note from Ken Sykes at Microsoft.  He
  54. had sped up the rgbvary.c code in Graphics Gems III by using integers instead
  55. of floating point.  Doing this reduced filtering time by a factor of 8 on his
  56. PC.  He wished more publicly available code used integer arithmetic when
  57. possible.
  58.  
  59. The ray tracing roundup in this issue shows that people are quite busy out
  60. there.  I've broadened the bounds of the column a bit to include other
  61. rendering related releases, since the dividing line between ray tracing and
  62. other algorithms is not particularly sharp nor important (for example, you may
  63. preview a ray trace with a z-buffer algorithm, or use scanline methods to
  64. accelerate your ray tracer).
  65.  
  66. -------------------------------------------------------------------------------
  67.  
  68. New People, New Places, etc
  69.  
  70. George Simiakakis
  71. SYS PG
  72. University of East Anglia
  73. Norwich NR4 7TJ
  74. England
  75. A118@CPC865.EAST-ANGLIA.AC.UK
  76.  
  77. Interests : subdivision techniques, radiosity
  78.  
  79. For the moment I am investigating 5D subdivision techniques for ray tracing.
  80. Starting from the Ray Classification algorithm I am trying to come up with a
  81. more efficient algorithm with less variance in it's performance.  The main
  82. ways of doing that are adaptive choice of subdivision parameters and
  83. degeneration of 5D subdivision to spatial subdivision where this is
  84. appropriate.
  85.  
  86. -------------------------------------------------------------------------------
  87.  
  88. An Easily Implemented Ray Tracing Speedup, by Steve Worley
  89.     (spworley@netcom.com)
  90.  
  91. Most ray tracing acceleration methods are variants of just a few simple ideas
  92. that somehow presort space to minimize the number of objects that must be
  93. tested for intersection.  Grids (uniform and non-uniform), octrees, and
  94. hierarchical bounding boxes are probably the most common methods though there
  95. are of course many more.
  96.  
  97. Grids and octrees are certainly the most popular, and they do quite an
  98. effective job at speeding up intersections by reducing the number of candidate
  99. objects that the ray might hit.  More speed is always better, of course, so
  100. there are always variants of these methods usually with a time speedup at the
  101. expense of storage, preprocessing, and/or programming complexity.
  102.  
  103. I've thought up a small, quick, trick that can be included in almost any
  104. grid-type sorting algorithm.  It trades off storage space for a decent
  105. speedup, but its biggest charm is very easy implementation.  Modification of
  106. your favorite grid-sorting algorithm is probably only an hour or two of work.
  107.  
  108. The trick is based on the observation that the number of "cubes" that a ray
  109. passes through per unit length is a function of the direction of the ray.  A
  110. uniform unit-sized grid aligned along the world axes is the easiest
  111. demonstration of this, though it works for non-uniform grids and octrees too.
  112. If a ray is pointed straight along the X axis, it will obviously "skewer" an
  113. entire row of cubes.  At a distance of n units, the ray has passed through n
  114. unit cubes.
  115.  
  116. If the ray's direction is different, though, it passes through MORE cubes.  At
  117. a 45 degree angle ( the unit vector is xn=0.707 yn=0.707 zn=0.0), the ray will
  118. have moved an x distance of 0.707*n units and a y distance of 0.707*n units.
  119. It has passed through a total of 1.414*n cubes!  [This is correct:  A ray will
  120. only pass from one cube to a cube that it shares a face with.  Most algorithms
  121. never even check for a diagonal step, since this has a vanishingly small
  122. probability when you're dealing with floating point numbers.  For example, a
  123. ray going from cube 0,0 to cube 1,1 might go from 0,0 to 0,1 to 1,1 and not
  124. straight from 0,0 to 1,1.]
  125.  
  126. The number of unit cubes a ray passes through (at the limit of n large) is
  127. just the sum of the absolute x,y,and z distances the ray traverses.  The
  128. important thing to notice is that the volume of space that contains objects
  129. that need to be tested for intersection with the ray is directly proportional
  130. to this number of cubes.  The more cubes the ray passes through, the more
  131. intersections you'll probably have to do.  It is therefore "cheaper" to test a
  132. ray that moves right along an axis, which passes through one cube per unit
  133. length, than one that moves at a perfect diagonal along the lattice (from 0 0
  134. 0 to the direction 1 1 1 ) which passes through 1.703 cubes per unit length.
  135. THIS WORST CASE HAS TO TEST 70% MORE VOLUME (AND OBJECTS) THAN THE BEST CASE.
  136. This is all due simply to the direction of the ray as compared to the
  137. coordinate system of the grid.  I wrote a quick program to find the "average"
  138. case, which was about 1.3 cubes per unit length, assuming all ray directions
  139. were equally likely.
  140.  
  141. My algorithm enhancement is based on this grid orientation dependency.  The
  142. basic idea is simple:  just make one (or more) EXTRA grids with the same
  143. objects, but with the grids at an angle to the original grid.  To test a ray
  144. with the objects in the world, you just choose which grid is most "aligned"
  145. with the ray along any axis.  This "best" alignment can be determined quickly
  146. and simply by looking at the (normalized) ray direction in each grid's
  147. coordinate system.  The function [fabs(xn)+fabs(yn)+fabs(zn)] tells you the
  148. number of cubes per unit length that the ray will pass through.  The smaller
  149. this number the better, since less volume (and on the average less objects)
  150. will have to be tested.
  151.  
  152. Storage requirements are obviously increased:  two grids take twice the room
  153. of one.  [Always a trade off!]  But usually the grids aren't THAT large, since
  154. they just store lists of object ID's and not the actual objects themselves.
  155. The time to assemble the grid is obviously increased but I found that it was
  156. easy to modify the loop that decides what box(es) each object goes into so
  157. that it did all of the grids simultaneously with the same loop.  For two
  158. grids, it increased preprocessing time by about 70%.
  159.  
  160. What kind of overall speedup is expected?  Well, the more grids (at different
  161. angles) that are used, the better your ray-alignment will be on average,
  162. meaning fewer cubes will have to be tested.  The testing to determine which
  163. set of boxes to use takes a trivial amount of extra time, but the extra
  164. preprocessing to make the grids IS significant.  Also, there will STILL be
  165. inefficiency:  every ray can't always be directly along an axis of one of the
  166. grids.  I implemented a two grid and a four grid model.  Though I didn't spend
  167. a whole lot of time in optimization, the four grid method was horrible:  the
  168. preprocessing step took far too long for a scene with about 1000 objects,
  169. slowing down the overall render time.  For two grids (the second grid rotated
  170. at a 45, 45, 45 degree angle, you know what I mean), the speedup was evident:
  171. Preprocessing was about 170% of the old time, but actual rendering was about
  172. 25% faster.  Depending on how many objects were being traced, the overall
  173. speedup was from 0% to 20%.  This is in no way a revolutionary speedup, but
  174. for about two hours of programming it is not bad!  Also, these numbers are
  175. based on a non-optimized program, and can only get better if I do a more
  176. careful implementation.
  177.  
  178. Why wasn't the rendering speedup more than 25%?  A couple of reasons.  The
  179. biggest is that when a ray passes though more volume, there TENDS to be more
  180. objects that need to be intersected.  But there's often many objects that span
  181. adjacent boxes, and these (in a good implementation!)  are not re-tested so it
  182. doesn't matter much that the extra volume was passed though.  It depends on
  183. the object density and size:  if most objects were small compared to the box
  184. size and roughly uniformly distributed in space, the number of objects tested
  185. would correlate better with the volume of the cubes that the ray passes
  186. through.  [Which is really what we're reducing with this algorithm.]  But even
  187. when most grids are empty or have objects that span many cells, using the more
  188. "aligned" grid is never going to hurt:  testing less cells is going to be
  189. easier.
  190.  
  191. Anyway, there might be some improvements to this idea (it's only about a week
  192. old!) but it is so simple to implement that I thought I'd pass it along.
  193. I've implemented it for uniform grids (very simple but not necessarily the
  194. best!) and octrees.  I have not tried to make a non-uniform grid yet, but
  195. you'd probably have to make a modification of the cost function based on the
  196. AVERAGE x, y, and z sizes of the boxes.
  197.  
  198. If anyone implements this idea or has any new ideas, I'd like to hear about
  199. it.  Meanwhile I'll hopefully get some time to run some more accurate
  200. benchmarks.
  201.  
  202. -------------------------------------------------------------------------------
  203.  
  204. Color Storage, by Greg Ward (greg@hobbes.lbl.gov)
  205.  
  206. From the Radiance Digest, v2n4 (dedicated to questions from users of Radiance.
  207. For a free subscription, write Greg)
  208.  
  209. Jim Callahan <jmc@sioux.eel.ufl.edu> writes:
  210.     I understand that Radiance stores images as 32-Bit RGB.  How does
  211. an adjustment of exposure effect the colors displayed.  Obviously it
  212. affects the brightness of the image, but what are the differences between
  213. exposure and gamma correction? Are both needed?  If a light source is too
  214. dim, I want to know in absolute terms.
  215.  
  216.     This is a bit confusing to me because I realize that the eye is
  217. constantly readjusting its exposure.  I would like to be able to say that
  218. the image is a "realistic" simulation of a scene, but can this really be
  219. done?
  220.  
  221. ----
  222.  
  223. Greg replies:
  224.  
  225. You've touched on a very complicated issue.  The 32-bit format used in
  226. Radiance stores a common 1-byte exponent and linear (uncorrected gamma)
  227. values.  This provides better than 1% accuracy over a dynamic range of about
  228. 10^30:1, compared to about 3% accuracy over a 100:1 dynamic range for 24-bit
  229. gamma-corrected color.
  230.  
  231. Changing the exposure of a Radiance image changes only the relative brightness
  232. of the image.  Gamma correction is meaningful only in the presence of a
  233. monitor or display device with a power law response function.  Gamma
  234. correction is an imperfect attempt to compensate for this response function to
  235. get back linear radiances.  Thus, applying the proper gamma correction for
  236. your monitor merely gives you a linear correlation between CRT radiance and
  237. the radiance value calculated.  (Radiance is named after the value it
  238. calculates, in case you didn't already know.)
  239.  
  240. However, as you correctly pointed out, linear radiances are not necessarily
  241. what you want to have displayed.  Since the dynamic range of a CRT is limited
  242. to less than 100:1 in most environments, mapping calculated radiances to such
  243. a small range of dispayable values does not necessarily evoke the same
  244. response from the viewer that the actual scene would.  The film industry has
  245. known this for many years, and has a host of processing and exposure
  246. techniques for dealing with the problem.  Even though computer graphics
  247. provides us with much greater flexibility in designing our input to output
  248. radiance mapping, we have only just begun to consider the problem, and it has
  249. not gotten nearly the attention it deserves.  (If you are interested in
  250. learning more on the topic, I suggest you check out the excellent CG+A article
  251. [not out yet, should be good. - EAH] and longer Georgia Tech technical report
  252. by Jack Tumblin and Holly Rushmeier.)
  253.  
  254. Color is an even stickier problem.  Gary Meyer and others have explored a
  255. little the problem of mapping out-of-gamut colors to a CRT, but offhand I
  256. don't know what work has been done on handling clipped (over-bright) values.
  257. This is another interesting perceptual issue ripe for exploration.
  258.  
  259. The best you can currently claim for a computer graphics rendering is that
  260. photography would produce similar results.  Combined with accurate luminance
  261. calculations, this should be enough to convince most people.  In absolute
  262. terms, the only way to know is by understanding lighting design and
  263. luminance/illuminance levels appropriate to the task.  It will be many years
  264. before we will have displays capable of SHOWING us unambiguously whether or
  265. not a given lighting level is adequate.
  266.  
  267. [Graphics Gems II has an article "Real Pixels" and code by Greg Ward for using
  268. 32 bit format for RGB.  The on-line distribution has more code than the book,
  269. as I recall.  - EAH]
  270.  
  271. -------------------------------------------------------------------------------
  272.  
  273. Bounding Areas for Ray/Polygon Intersection, by Steve Worley
  274.     (spworley@netcom.com) and Eric Haines (erich@eye.com)
  275.  
  276. The last issue of RTN (v5n3) was devoted to fast methods of intersecting rays
  277. with polygons and particularly the subtask of determining whether a single
  278. point was inside a 2D polygon.  We (Eric and Steve) have been discussing
  279. another aspect of polygon intersection:  the best type of bounding volume to
  280. surround polygons with, particularly complex ones that have enough sides that
  281. the "is the point in the polygon?" test gets slow.
  282.  
  283. One particularly useful trick if you do have a bounding volume around the
  284. polygon (say an axis-aligned cube) is to check the ray/plane intersection
  285. POINT with the bounding volume.  The point in volume test is very cheap (6
  286. compares) and provides a way to trivially reject hits that are far from the
  287. polygon.  This quick rejection method has been developed by several people
  288. independently, and Albert Woo has a nice description in Graphics Gems I on
  289. page 394.  The only possible danger of using this extra rejection is that that
  290. a polygon laying on an axis-aligned plane will have a bounding box with no
  291. depth, and the "ray hits box?" and/or "point in box?" algorithms need to be
  292. robust enough to correctly handle it.
  293.  
  294. The method is therefore:
  295.  
  296.   1) Test to see if plane's normal is facing you (50% culling right here!)
  297.   2) Test to see if ray intersects bounding cube at all
  298.   3) Intersect the ray with polygon's plane
  299.   4) Test intersection POINT with bounding cube
  300.   5) Test intersection point for in/out polygon
  301.  
  302. But what if you eliminated the ray/bounding cube test (#2) completely and for
  303. ALL (facing) polygons you computed the ray/plane intersection and tested that
  304. point with the bounds?  If you count up the ray/bounding box test's costs, you
  305. need 3 adds, 3 divides, and 13 compares (This is from Woo's algorithm in GG
  306. I.)  But intersection with a plane only costs 5 adds, 5 mults, and 2 compares,
  307. since you already computed the dot product to test whether the plane was
  308. facing you or not.  So basically you can skip right ahead to the "is the
  309. ray/plane intersection POINT in the bounding box" (which provides better
  310. rejection than the ray/cube intersection) and you'll be ahead speed-wise.
  311.  
  312. Now here's a neat trick:  if you're now JUST using the bounding volume to
  313. provide point rejection (not ray rejection) we might as well do it ONLY in the
  314. 2D projected plane we also do our in-out tests in.  We don't even have to
  315. compute that third component (the one we don't use for testing polygon in/out
  316. anyway,) saving a mult or two.  We basically have a 2D bounding AREA and not a
  317. bounding volume.  The third coordinate did provide some additional rejection,
  318. but how effective it is depends on the plane's angle:  the Z coordinate is a
  319. linear function of X and Y.  This also avoids any ugliness from a zero-height
  320. bounding box.
  321.  
  322. The bounding AREA will do a fast rejection of trivial points far away from the
  323. center of interest.  RTNv5n3 had several discussions of different test
  324. methods, but all of them might be helped by this trivial rejection depending
  325. on the complexity of the polygon.  (Any bounding for a triangle is probably a
  326. waste, but if you have a 500 sided polygon, doing at least a gross rejection
  327. of far off points is going to be a severe win.)
  328.  
  329. NOTE:  This does not mean that a bounding volume is necessarily a bad idea for
  330. a polygonal object!  It DOES mean that a bounding volume for a SINGLE polygon
  331. is definitely slower than doing a 2D point rejection instead.
  332.  
  333. The question is for these complex-enough polygons, what type of rejection to
  334. use?  (The rest of this discussion assumes the XY plane is the plane being
  335. used for the polygon test, but XZ or YZ are obviously just the same.)  The
  336. bounding square (max/min X,Y) is by far the most obvious and useful, since it
  337. only costs 4 compares and will reject all of the way-off hits.  A tighter
  338. bound might be useful for a more complex figure, however.  One logical further
  339. test would be to measure the maximum extents of the polygon along other
  340. directions such as the 45 and 135 degree angles:  you sort of get a tight
  341. shrink-wrapped octagon bounding your polygon.
  342.  
  343. If you want to check the 45 degree angles, you do a separate min/max test on
  344. the value sqrt(1/2)*X+sqrt(1/2)*Y, which is just a coordinate rotation of the
  345. point by 45 degrees.  The 135 degree rotation is done by testing
  346. sqrt(1/2)*X-sqrt(1/2)*Y.  The extra 4 rejections therefore cost 2 adds, 4
  347. mults, and 2 compares.
  348.  
  349. Now here's a really sneaky trick:  What if you change to an *UNNORMALIZED*
  350. coordinate system.  Don't check sqrt(1/2)*X+sqrt(1/2)*Y, check instead X+Y!
  351. The maximum extent you're checking against absorbs that normalization
  352. constant, but that is the only thing you ever use these min/max numbers for so
  353. it is not a problem.
  354.  
  355. So to evaluate the shrink wrapped octagon, you:
  356.  
  357.  1) Check min/max X span                 2 compares
  358.  2) Check min/max Y span                 2 compares
  359.  3) Compute A=X+Y                        1 add
  360.  4) Check min/max A span                 2 compares
  361.  5) Compute B=X-Y                        1 add
  362.  6) Check min/max B span                 2 compares
  363.  
  364. You could continue into 16 sided shrinkwrapped hulls if you really need to
  365. (C=A+X D=B+X E=A+Y F=B-Y) but this is probably tight enough for anybody.
  366.  
  367. This type of bounding box is useful for other types of point sampling as well;
  368. solid texturing evaluates functions of a single point and they often have a
  369. region where a color or pattern is applied to a central location and outlying
  370. areas are left alone or colored with a background.  A 16 sided bounding volume
  371. (this time in 3D) only takes 16 compares and 6 adds (by coincidence, the same
  372. as 2D.)  This has been implemented in several textures, in particular one that
  373. renders Bezier outline fonts on an object's surface.
  374.  
  375. ---
  376.  
  377. A very different method for trivial rejection of 2D points takes much more
  378. precomputation but has the additional benefit of trivial ACCEPTANCE.
  379. Basically, you impose a uniform grid onto the XY plane and classify each box
  380. in the grid as inside, outside, or indeterminate.  Only when a point lies in
  381. an "indeterminate" box does the full point-in-polygon routine need to be
  382. called.  Any point that falls outside the grid is automatically rejected.
  383. (The grid is sized to just fit over the polygon.)  This method is especially
  384. effective for many-sided but simple polygons that have a lot of "empty" inner
  385. area since any hits on the inside away from the edges are quickly accepted.
  386.  
  387. This grid isn't too hard to make.  You "render" each polygon segment into the
  388. grid, marking any boxes the line touches with an ID meaning "indeterminate."
  389. Flood fill any untouched boxes that lie along the outside edge of the grid
  390. (using the N S E W neighbors) with a flag saying "outside."  Then use the
  391. "point in polygon" routine in the center of each of the remaining untouched
  392. squares to determine its state, inside or outside.  When you determine a new
  393. square, you can flood fill its unchecked neighbors.  This all works since the
  394. only indeterminate boxes are the ones that edges pass through, and an edge
  395. (and therefore an "indeterminate" box) will always separate any transition
  396. between inside and outside.  This will work for either winding number or
  397. even-odd methods of point-in-polygon definition.
  398.  
  399. The lookup grid is expensive in terms of memory, but the speedup can be
  400. significant especially for large or complex polygons.  Each box in the grid
  401. needs two bits of storage since there are three possibilities to choose from.
  402. A cheaper but slower alternative is to use only one bit to encode the
  403. in/out/indeterminate state.  During precompute, count up the number of boxes
  404. for acceptance and rejection, and encode the less common state as
  405. indeterminate.
  406.  
  407. [I have implemented this algorithm and it works very well, giving you near
  408. O(1) performance for "reasonable" data.  I used the outlines of continents for
  409. my polygons (from 164 to 1152 points) and had good results.  This algorithm
  410. would probably be good for GIS applications.  The indeterminate cells can be
  411. evaluated much faster by noting which edges actually pass through the cell.
  412. Since you know the state of the corners of the cell (i.e. each corner is in
  413. or out), you draw a line segment from your test point to the nearest cell
  414. corner (or any corner, but the nearest should have less crossings).  Using the
  415. ideas of Mukesh Prasad in Graphics Gems II for line segment intersection
  416. testing, you can quickly find how many crossings occur between the test point
  417. and the cell corner and so know the test point's status.  - EAH]
  418.  
  419. One implementation danger is in ROBUSTLY identifying each square in the lookup
  420. grid that any edge passes though.  A vertical or horizontal polygon edge might
  421. lie right along the borders of a square in the lookup grid, or less commonly,
  422. a line might pass diagonally through a corner of one of the squares of the
  423. grid.  In both cases it is probably best to be conservative and identify the
  424. adjoining square(s) as indeterminate.
  425.  
  426. One modification of this algorithm can speed it up further.  Instead of
  427. recording just three states in the look-up grid, a fourth state meaning
  428. "unprocessed" is added.  During precomputation, you mark all of the
  429. "indeterminate" squares as before, but you don't do anything else.  (Your grid
  430. after pre-computation will therefore be filled only with "indeterminate" and
  431. "unprocessed" squares.)  When you begin rendering, you use the grid as before,
  432. but when you hit an "unprocessed" square, you do the point-in-polygon test,
  433. record the answer in the grid, do the flood-fill of the neighbors, and return
  434. the correct answer.  This method is a little bit more complex to implement,
  435. but you'll only end up doing the minimum amount of work building the grid
  436. since you set it up partially "on demand."
  437.  
  438. ----
  439.  
  440. These bounding area methods are useful complements to the point-in-polygon
  441. test.  They provide quick rejections (or acceptances) the number of times that
  442. the (relatively) slow point in polygon routine is called, exactly the same way
  443. that a bounding volume can provide quick rejection of ray/object
  444. intersections.
  445.  
  446. -------------------------------------------------------------------------------
  447.  
  448. Simple, Fast Triangle Intersection, by Chris Green
  449.     (chrisg@cbmvax.cbm.commodore.com) and Steve Worley
  450.     (spworley@netcom.com)
  451.  
  452. Chris writes about RTNv5n3:
  453.  
  454.     I am always surprised to see articles advocating angle tests,
  455. intersection counting, or Barycentric coordinates for determining if an
  456. intersection point is inside of a 3d dimensional triangle, when the simple way
  457. of determining this is also the fastest, if you can live with a few more bytes
  458. stored per triangle.
  459.  
  460. My Method:
  461.  
  462.     Store with each triangle 2 indices, i1 and i2.  These are the
  463. coordinate offsets for the two axes that will be considered in the test.  (the
  464. axis with the largest component in the normal vector is dropped, as usual).
  465. Store the 2 coefficients and the 1 constant of the "inside-outside" equation
  466. of each edge.
  467.  
  468.     To test for intersection, calculate C[0]*X[i1]+C[1]*X[i2]+C[2] (X is
  469. the intersection coordinate, and C are the 3 constants for the linear equation
  470. calculated at setup time) over all 3 edges.  If any of them have a negative
  471. (or positive depending upon which convention you choose) result, return
  472. NO_INTERSECTION.
  473.  
  474.     Assuming hardware multiply, this can be coded extremely efficiently,
  475. and can take advantage of multiply-accumulate instructions if they are
  476. available.  In fact, with a fast MAC instruction, it might be more efficient
  477. to skip the coordinate indexing all together and just use the 3d equation of
  478. the plane passing through the edge perpendicular to the triangle on some
  479. architectures.
  480.  
  481.     The only further optimization I take is that I store the edge
  482. equations sorted by the area of the 2d bounding volume of the triangle which
  483. is outside of that edge.
  484.  
  485.     In 68040 code, this all boils down to:
  486.  
  487.     move.l  0(a5,d6.w),d4           ; d6=i1, a5 = &intersection point
  488.     move.l  0(a5,d7.w),d3           ; d7=i2
  489.     muls.l  (a4)+,d0:d4             ; C0*X1
  490.     muls.l  (a4)+,d1:d3             ; C1*X2
  491.     add.l   d3,d4
  492.     addx.l  d1,d0                   ; C0*X1+c1*x2
  493.     movem.l (a4)+,d1/d3             ; fetch 64 bit constant term
  494.     add.l   d3,d4
  495.     addx.l  d1,d0                   ; c0*x1+c1*x2+c2
  496.     bmi.s   no_hit3                 ; outside?
  497.  
  498.     repeated 3 times.
  499.  
  500. --------
  501.  
  502. Reply from Eric Haines:
  503.  
  504.     I'll put your note in the next RTN - thanks.  Berlin, in the truly
  505. obscure reference
  506.  
  507. %A E.P. Berlin, Jr.
  508. %T Efficiency Considerations in Image Synthesis
  509. %B SIGGRAPH '85 course notes, volume 11
  510. %D July 1985
  511. %K polygon intersection
  512.  
  513. gives the same method you do (he thinks of it as three planes).  I assume that
  514. your method works for convex polygons only, unless you test all triangles
  515. within the polygon and check the parity [see RTNv5n3 for more information].
  516.  
  517.     The catch is, most people don't code in assembler (the counting
  518. crossings test is darned fast in assembler).  However, your test is darned
  519. fast anyway, at least for simple polygons.  The extra memory is something of a
  520. drawback, but who can complain?
  521.  
  522.     I coded it up (looked pretty efficient) and tried it in my test suite.
  523. Here are the results:
  524.  
  525. For random polygons:
  526.  
  527.              Number of vertices
  528.             3       4       5       3-7     20      100
  529.  
  530. plane               1.15    1.88    2.81    2.91   16.10   87.02
  531. macmartin           1.90    2.33    2.76    2.67   10.63   51.47
  532.  
  533. inside %            6.78   11.78   13.11   12.22   26.22   35.67
  534.  
  535.  
  536. For regular polygons:
  537.  
  538.              Number of vertices
  539.             3       4       5       3-7     20      100
  540.  
  541. plane               1.22    2.23    3.25    3.36   16.67   86.51
  542. macmartin           2.33    2.80    3.03    3.10    6.31   23.78
  543.  
  544. inside %           33.22   51.00   60.22   55.22   77.44   80.22
  545.  
  546.  
  547. Admittedly, for the regular polygons I could do the test for the plane set
  548. based on "first hit means quit", since the regular polygons are convex.  This
  549. will result in faster timings for it (as it would for the macmartin tests:  if
  550. two crossings are found while doing the macmartin test for convex polygons,
  551. then you can quit).  It's cool that your test is better for 3 and 4 vertex
  552. polygons, since these are real common.
  553.  
  554. --------
  555.  
  556. Chris replies:
  557.  
  558.     Thinking about my method applied to polygons with large (>4) numbers
  559. of sides, I realized that the edge equations should be stored in bit-reversed
  560. order, assuming some bounding volume that reduces PIP tests to only those
  561. points which are somewhat near the polygon, and also assuming most polygons
  562. are relatively regular.
  563.  
  564.     Imagine an octagon surrounded by a rough bounding box.  If the first
  565. side didn't clip off the point, the 2nd isn't that likely to if it is at a
  566. similar angle to the first one.  But the opposite side is more likely to.  The
  567. optimal thing to do is to calculate the area which is inside the bounding box
  568. which has not yet been clipped off by one of the previous edges, but this
  569. would involve calculating intersections of the edges with each other, which is
  570. probably too much work to do on a polygon which might only cover 10 pixels on
  571. the output image.
  572.  
  573.     The algorithm is to check the point against the edge equations of each
  574. edge of the convex polygon (the "inside-outside" equation of the edge).  i.e:
  575.  
  576.     if v0 is one vertex and v1 is another, and v2 is another point on the
  577.     polygon,
  578.  
  579.     a=v1.x-v0.x
  580.     b=-(v1.y-v0.y)
  581.     c=-(a*v1.x+b*v1.y)
  582.  
  583.     if (a*v2.x+b*v2.y+c>0) then negate a,b,c to make the inside-outside
  584.      sense correct.
  585.  
  586.     Which coordinate x and y are depends, of course, upon the surface
  587.     normal of the triangle.
  588.  
  589. intersect:
  590.  
  591.     x,y=intersection point of ray and plane projected onto the correct axis.
  592.  
  593.     for(each edge)
  594.         if (x*a[i]+y*b[i]+c[i] >0) then no_intersection
  595.  
  596. All the abc[i]'s are sorted in such a way (based upon the bounding volume) so
  597. as to make the probability high that the first test will reject the point.
  598. For a many-sided (roughly regular) convex polygon, storing the sides in bit
  599. reversed order (for an 8 sided polygon this is 0,4,2,6,1,5,3,7) causes the
  600. loop above to test the point against a bounding volume which "homes-in" on
  601. the actual shape of the polygon.  For a triangle, I store the sides based upon
  602. the area of the triangle cut out by the intersection of the edge and the
  603. bounding box.
  604.  
  605. ----
  606.  
  607. Steve Worley (spworley@netcom.com) had some independent observations, also
  608. realizing that half-plane testing should be fast:
  609.  
  610. In RTNv5n3, Peter Shirley wrote about a fast triangle test using barycentric
  611. coordinates.  It seems to me that the fastest method (by far!) to test
  612. whether a point is in a 2D triangle is to just do three half-plane tests.
  613. Represent each of the lines that make up the triangle with two real numbers A
  614. and B such that the line is described by the formula Ax+By=1.  If the triangle
  615. lies below that line, a point on the "wrong" side of the line will satisfy the
  616. inequality Ax+By>1.  If the triangle is "above" the line, you just test
  617. Ax+By<1 instead.  You do this test for each of the three triangle sides, and
  618. immediately return if it fails at any time.  If it passes all three tests, the
  619. point is in the triangle.  The computational cost is two multiplies, an add,
  620. and two compares for each test, so worst case cost is 6 mults, 3 adds, 6
  621. compares.  However, you're more likely to get rejected on the first tests, and
  622. the mean amount of computation for a completely random triangle turns out to
  623. be exactly 3.5 mults, 1.75 adds, and 3.5 compares.
  624.  
  625. A slightly faster method would be to write each line in the form Cx+y=D
  626. instead, which would save a multiply on each test.  However this causes a
  627. problem because of perfectly vertical lines which would make C and D become
  628. infinite.  An extra compare would be needed to check for this case so that the
  629. more general Ax+By=1 test could be substituted.
  630.  
  631. While this method is probably about as fast as a 2D point in triangle test can
  632. get, Shirley's barycentric method has one big advantage in that AFTER a hit,
  633. the computed coordinates can be immediately used for Gouraud or Phong shading.
  634. Depending on the percentages of tests versus hits your application gets, it
  635. might be cheaper to use only barycentric if typical tests have a high enough
  636. hit rate.  Note also that both the barycentric and the half-plane rejection
  637. methods will work on any convex polygon.
  638.  
  639. -------------------------------------------------------------------------------
  640.  
  641. Ray Tracing Roundup
  642.  
  643. The big news is that there is now an FTP site with some excellent 3D model
  644. datasets available.  Go to avalon.chinalake.navy.mil (129.131.31.11).  If you
  645. can't reach it, or your connection is slow, the site is mirrored on
  646. ftp.kpc.com (144.52.120.9) in /pub/mirror/avalon.  The objects in
  647. obj/Viewpoint are of particularly high quality:  there's a cow, foot bones,
  648. Beethoven's bust, a brontosaurus, a toy galleon, and I forget all what else,
  649. plus many road vehicles, a helicopter, etc.  There are also the Capone
  650. datasets, in case you didn't get yours free at SIGGRAPH at the Viewpoint
  651. booth.  I liked these .obj files well enough that I even wrote an obj2nff awk
  652. script (which is also FTPable from avalon - dig around).  And this is just one
  653. set of models - there are others from many other sources.  If they're missing
  654. your favorite dataset, upload it to them.  contact:  Francisco X DeJesus
  655. (dejesus@archimedes.chinalake.navy.mil)
  656.  
  657. --------
  658.  
  659. The February 1993 issue of National Geographic has a fold-out image of Venus
  660. on page 37.  This image was rendered by David Anderson at SMU using Craig
  661. Kolb's Rayshade software.  Also, the computer firm Santa Cruz Operation is
  662. evidently using/going to use images made from public scene files by Rayshade
  663. in showing off their SCO Open Desktop.
  664.  
  665. --------
  666.  
  667. A new book on ray-tracing has come out, and comes with a disk of code for
  668. "Bob", a ray tracer (of at least 8K lines of code).  Note that Stephen Coy is
  669. also the creator of the VIVID ray tracer.  I hope to review this book for the
  670. next issue of the RTN - EAH.  It's at least 8k lines of code.
  671.  
  672.     Photorealism & Ray Tracing in C
  673.     Christopher D. Watkins, Stephen B. Coy, and Mark Finlay
  674.     M&T Books, a division of M&T Publishing, Inc.
  675.     411 Borel Avenue, Suite 100
  676.     San Mateo, CA  94402   (C) 1992
  677.     ISBN 1-55851-247-0
  678.  
  679. Some comments from Stephen Coy:
  680.  
  681. Bob, the raytracer in the book, is basically Vivid with a few, minor changes.
  682. The changes tend to center around the parser.  I didn't want to use flex and
  683. byacc for the book so I spent a long day writing the parser from scratch in C.
  684. Everything works except allowing the user to perform math functions in the
  685. input files.  I'd like to see some benchmarks with Bob vs some of the other
  686. tracers out there.  Even though it is distantly derived from MTV I think it
  687. will generally beat MTV by quite a bit.
  688.  
  689. Before you ask, the name Bob just sort of happened.  When I was working on the
  690. code I got tired of talking to Chris and calling it "the ray tracer for the
  691. book."  I suggested that we just call it Bob until we came up with a better
  692. name.  The deadlines came first.
  693.  
  694. --------
  695.  
  696. Another new book is _Practical Ray Tracing in C_ by Craig A. Lindley.  It
  697. contains a disk for the IBM PC and the ray tracer is DKB Trace.  I assume it
  698. has the same features as the PD one on the net (and vice versa).  The book is
  699. evidently a $49.95 paperback (with disk of course).  (Tom Wilson,
  700. wilson@eola.cs.ucf.edu)
  701.  
  702. [Does anyone know anything about this book?  I haven't seen it and am unwilling
  703. to blow bucks on it.  Any review (biased or no) is appreciated! - EAH]
  704.  
  705. --------
  706.  
  707. For those of you who still believe free software is worthless, a comment from
  708. a guy at NASA on Radiance [an "industrial strength" lighting simulator free
  709. from Greg Ward - a ray tracer and much more]:
  710.  
  711. By the way, your package is a very good one, in just 2 weeks we were able to
  712. trace complex space shuttle lighting very easily.  Nice work.
  713.  
  714. --------
  715.  
  716. The source code from the notes of Siggraph '92 Course 23 (Procedural Modeling
  717. and Rendering Techniques) is now available for anonymous ftp from
  718. archive.cis.ohio-state.edu as pub/siggraph92/siggraph92_C23.shar .  Without a
  719. copy of the course notes, these files may not make sense.  (David Ebert,
  720. ebert@hockey.cis.ohio-state.edu)
  721.  
  722. --------
  723.  
  724. Human heads and an anatomically correct human skull data are available.  The
  725. data is a mesh and the demo contains convert utilities to translate into
  726. various other formats, eg.  ASCII, Wavefront, IGES, etc.  The demo runs on a
  727. SGI IRIS workstation.  Ftp from taurus.cs.nps.navy.mil, login anonymous,
  728. password guest, file pub/dabro/cyberware_demo.tar.Z .  (George Dabrowski,
  729. Cyberware Labs, dabro@taurus.cs.nps.navy.mil)
  730.  
  731. --------
  732.  
  733. A simple public-domain radiosity package is available at ftp.yorku.ca (was:
  734. nexus.yorku.ca) (130.63.9.66) in /pub/reports/Radiosity_code.tar.Z (also
  735. mirrored at wuarchive.wustl.edu).  The package contains C code for a
  736. progressive refinement solution using the following algorithms:
  737.  
  738.     Wallace (Ray-traced form-factors),
  739.     Haines (Shaft Culling), using automatic hierarchical
  740.         bounding creation (Salmon 87)
  741.     Chen (Progressive refinement with jitter hemicubes)
  742.     A partial implementation of Hanrahan's BF-Refinement algorithm.
  743.  
  744. Additionally, there are model preprocessors for conversion from QuickModel and
  745. OFF formats, with geometric constraints of Baum's 91 Siggraph paper partially
  746. included; and a scene walk through program with simple Gouraud shading.  The
  747. solution can be run stand-alone on any Unix box, but the walk-through requires
  748. a SGI 4D.  (Bernard Kwok, g-kwok@cs.yorku.ca)
  749.  
  750. --------
  751.  
  752. Version 2.2 of x3d, a 3D wireframe / hidden line / hidden surface viewer that
  753. runs under X11, is now available via anonymous ftp at castlab.engr.wisc.edu
  754. (144.92.60.140) and is found as /pub/x3d.2.2.tar.Z.  (Mark Spychalla,
  755. spy@castlab.engr.wisc.edu)
  756.  
  757. --------
  758.  
  759. If you use AutoCAD 11 Advanced Modelling Extensions (AME) software to build 3D
  760. objects, it is now possible to convert these models to a raytracer compatible
  761. scene file format (SCN), which is used by the RTrace package (raytracer plus
  762. utilities).  The converter code is available at asterix.inescn.pt
  763. [192.35.246.17] in directory pub/RTrace/scene-conv/acad (files scn.h and
  764. sol2scn.h).
  765.  
  766. A MAC version of RTrace 1.0 version (beta) is available in directory
  767. pub/RTrace/Macintosh at asterix.inescn.pt [192.35.246.17] The code was made by
  768. me; Reid Judd (reid.judd@east.sun.com) and Greg Ferrar
  769. (gregt@function.mps.ohio-state.edu) made the Mac port.  (Antonio Costa,
  770. acc@asterix.inescn.pt)
  771.  
  772. --------
  773.  
  774. A new release of Tcl-SIPP is available from:
  775.  
  776.     ftp.uu.net:/graphics/3D/tsipp.3.0b.tar.Z
  777.  
  778. and should be available soon from:
  779.  
  780.     barkley.berkeley.edu:/tcl/extensions/tsipp3.0b.tar.Z
  781.  
  782. Tcl-SIPP is a 3D image specification and rendering toolkit for use with Tcl
  783. and Tk.
  784.  
  785. It provides a Tcl command interface to SIPP, the SImple Polygon Processor
  786. library.  This is used for creating 3-dimensional scenes and rendering them
  787. using a scanline z-buffer algorithm.  The Tcl interpretive programming
  788. language is used to provide a powerful, yet simple interface to this library.
  789. The scene may be written to either a PPM format file, as defined by the
  790. PBMPlus toolkit or a RLE file, as defined by the Utah Raster Toolkit.
  791.  
  792. An interface to render to the photo widget in the Tk X11 toolkit is also
  793. provided.  Events such as button presses may take place while rendering is
  794. in progress. (markd@NeoSoft.com, Mark Diekhans)
  795.  
  796. --------
  797.  
  798. Under princeton.edu:pub/Graphics/rayshade.4.0, you'll find several new
  799. directories, including:
  800.  
  801. Contrib            User-contributed enhancements, header files, etc.
  802. Amiga/DOS/MAC/OS2    Ports to various strange operating systems.
  803. Pix            Rayshade-generated images, texture maps, etc.
  804.  
  805. There have been other changes to the archive; poke around and you'll
  806. undoubtedly discover them.
  807.  
  808. ----
  809.  
  810. I've placed all of the old rayshade-users messages on the princeton archive:
  811.     princeton.edu:pub/Graphics/rayshade-users/Feb-Sep92.Z.
  812.  
  813. This file is completely unedited -- if it was sent to the list between
  814. February and September 28th, it appears here.  If some brave soul wants to
  815. edit out the chaff, I'd be happy to replace the file with something more
  816. appropriate.
  817.  
  818. ----
  819.  
  820. Utah RLE viewers for the IBM PC are available at
  821. cad0.arch.unsw.edu.au:/pub/rayshade/dos.  They include:
  822.     drawutah13.exe   SVGA Utah rle viewer.
  823.     drwrle15.exe     Utah rle viewer (Tseng Labs HiSierra 15 bit DAC).
  824.     drwrle24.exe     Utah rle viewer (Tseng Labs HiSierra 24 bit DAC).
  825. The drawutah.exe may also be available from princeton.edu.
  826.  
  827. ----
  828.  
  829. A new rsdefs package for Rayshade is available.  Changes made were:  new
  830. surfaces added (copper, several diamond, several glasses to name a few), fixed
  831. documentation -- all the examples should work now, made primitives more easy
  832. to use, added surface information file -- information for developing new
  833. surfaces (just RI values and some color info sofar), added a script for batch
  834. testing surfaces.  Larry Coffin (lcoffin@clciris.chem.umr.edu)
  835.  
  836. ----
  837.  
  838. NCSA Polyview 3.0 is now available via anonymous FTP to ftp.ncsa.uiuc.edu
  839. (141.142.20.50) in /SGI/Polyview3.0.  Polyview 3.0 is a software tool for
  840. interactive visualization and analysis of 3D geometrical structures.  Polyview
  841. 3.0 reads data files in NCSA HDF Vset format and automatically derives
  842. animation sequences based on available information.  Script-based and
  843. graphical user interfaces complement each other in a seamless fashion to allow
  844. the easy creation of movie-style animations.  Rayshade users on SGIs may be
  845. interested in this; among other things, it generates scene files in rayshade
  846. 4.0 format (and also in Pixar's RenderMan format).  (Marc Andreessen,
  847. marca@ncsa.uiuc.edu)
  848.  
  849. --------
  850.  
  851. POLYRAY is a ray tracer that is "more difficult to use but substantially
  852. faster".  Version 1.4 is available at faramir(or
  853. ftp).informatik.uni-oldenburg.de (134.106.1.9) in
  854. pub/dkbtrace/incoming/polyray.  Note that the file has probably moved
  855. somewhere by now.  This site also contains a number of POV & DKBtrace scene
  856. files and images, as well as 3d fonts for POV and Vivid (Andy Haveland,
  857. andy@osea.demon.co.uk)
  858.  
  859. --------
  860.  
  861. If you're on (or have access to) an Amiga system, then you may want to check
  862. out Vertex, a shareware ($40) 3D object editor/converter.  It will read
  863. Wavefront .obj files and save them in Imagine, Sculpt 3D, Lightwave RayShade,
  864. GEO and 3D Professional file formats.  While not perfect, it does correctly
  865. read the Wavefront geometry from the file, and you can modify smoothing and
  866. face colors right in Vertex.  (Alex_-_DeBurie@cup.portal.com)
  867.  
  868. --------
  869.  
  870. White Sands Missile Range (192.88.110.20) in pd1:<msdos.graphics> carries
  871. Thunder, a ray tracer from Germany.
  872.  
  873. --------
  874.  
  875. A 512x512x24 bit Mandrill is available in PPM and JPEG formats from
  876. popeye.genie.uottawa.ca, in /pub/pics.  (Dominic Richens,
  877. dominic@shamin.genie.uottawa.ca)
  878.  
  879. --------
  880.  
  881. The cameraman image is available via anonymous ftp from eedsp.gatech.edu in
  882. database/images/camera.256.  The file is unformatted byte format with image
  883. dimensions 256x256.  (Stan Reeves, sjreeves@eng.auburn.edu)
  884.  
  885. --------
  886.  
  887. Graphtal is a L-system interpreter, and includes a number of features,
  888. including animation support, X11 previewer, z-buffer preview, and output for
  889. rayshade.  It is in C++, and currently works on SparcStations, RS/6000's, and
  890. DEC Stations.  The first public release of graphtal is now available via
  891. anonymous ftp at iamsun.unibe.ch (130.92.64.10) and is found as
  892.     /Graphics/graphtal-1.0.tar.Z or
  893.     /Graphics/graphtal_no_bison_no_flex-1.0.tar.Z.
  894. (Christoph Streit, streit@iam.unibe.ch)
  895.  
  896. --------
  897.  
  898. The Dr. Dobb's Journal's FTP directory ftp.mv.com /pub/ddj/packages has
  899. Xsharp, a fairly fast hidden surface displayer for the IBM PC.  Source code in
  900. C and assembler is included, and Xsharp now has some simple texture mapping
  901. capabilities.
  902.  
  903. --------
  904.  
  905. The GRAPHIC CONNECTION can be reached at the following numbers:
  906.     by modem: 503-591-8412
  907.     voice:    503-591-0134
  908.     FAX:      503-244-0919
  909. V.32bis/V.42.bis MNP, 24 hours a day.
  910.  
  911. This BBS is owned and operated by Vertech Design, is located in Portland,
  912. Oregon.  TGC specializes in material/texture files, custom bitmap design,
  913. graphics utilities and programs, and specialized scanning services.  There
  914. will also be a large message base with topic specific areas for all areas of
  915. CAD and graphics support.  Need more information?  E-mail me.  - Lynn Falkow,
  916. lynnf@techbook.com
  917.  
  918. [I tried this BBS out some time ago, but had trouble getting any material
  919. texture samples - the directory which was supposed to have these publicly
  920. available was inaccessible, for some reason.  I paged the sysop, but he didn't
  921. seem to know what was wrong, either.  - EAH]
  922.  
  923. --------
  924.  
  925. For 3D stereo supplies, one source is Reel 3D's mail order catalog:
  926.     Reel 3-D Enterprises, Inc.
  927.     P.O. Box 2368
  928.     Culver City
  929.     CA 90231
  930.     Phone (310)837-2368
  931.     Fax   (310)558-1653
  932. (Alexander Klein, editor of 3D-MAGAZIN, klein@nadia.stgt.sub.org)
  933.  
  934. --------
  935.  
  936. ftp.rahul.net [192.160.13.1]:/pub/bryanw has a number of programs related to
  937. JPEG and MPEG generation and display.  (Bryan Woodworth, bryanw@rahul.net)
  938.  
  939. --------
  940.  
  941. VIS-5D is a system for interactive visualization of 5-D gridded data sets such
  942. as those made by numeric weather models.  One can make isosurfaces, contour
  943. line slices, colored slices, wind vector slices, wind trajectories, etc.  of
  944. data in a 3-D grid and then rotate and animate the image in realtime.  There
  945. are also features for text annotation and video production.  Systems
  946. supported:  SGI, IBM RS/6000, Stardent/Stellar.  FTP from iris.ssec.wisc.edu
  947. (144.92.108.63).  It is also available on wuarchive.wustl.edu in the directory
  948. graphics/graphics/packages.  (brianp@ssec.wisc.edu, Brian Paul)
  949.  
  950. --------
  951.  
  952. Disc-1 Graphics- is a collection of more than 426 MegaBytes of popular public
  953. domain, shareware, and freeware graphics programs and data files.  The disc
  954. contains more than 1200 programs, 16,000 files.  The cost of the disc is
  955. $24.95 plus $5 to cover shipping and handling ($15 overseas).  Orders may be
  956. FAXed to (916)-872-3826.
  957. Prepaid orders may be mailed to : Knowledge Media
  958.                   436 Nunnelley Rd. Suite B
  959.                   Paradise,CA 95969, USA
  960. (Paul Benson, pbenson@cscihp.ecst.csuchico.edu)
  961.  
  962. --------
  963.  
  964. The Copyright Guide from the ASMP (American Society of Media Photographers) is
  965. available in digital form now.  FTP from ftp.eff.org:
  966. pub/cud/papers/asmp-guide, or ftp.ee.mu.oz.au:
  967. pub/text/CuD/papers/asmp-guide.Z, or ftp.moink.nmsu.edu.  Although written
  968. from a photographers perspective the Guide might help to clear up a few points
  969. of confusion about copyright protection of images.  (Don Smith,
  970. dsp@halcyon.com)
  971.  
  972. -------------------------------------------------------------------------------
  973.  
  974. Spectrum Overview, edited by Nick Fotis
  975.  
  976. Here's a glimpse of the SPECTRUM rendering testbed proposed by A.Glassner in
  977. the Frontiers In Resdering Course Note 12 from SIGGRAPH '91:
  978.  
  979. "... the architecture supports the following features:
  980.  
  981. o       Standard radiosity and distribution ray tracing features (energy
  982.     balancing, soft shadows, depth of field, motion blur, spectral
  983.     sampling, etc.)
  984.  
  985. o    User control of most rendering parameters (with defaults)
  986.  
  987. o    Programmable shaders, selected by the user in run time (including
  988.     textures)
  989.  
  990. o       Programmable sampling techniques.  Any sampling strategy may be used,
  991.     including (bu not limited to) staticc or adaptive, uniform or noisy.
  992.     Any sampler may be used to draw samples on any two-dimensional
  993.     distribution.  Higher-dimensional samplers may be used as well.
  994.  
  995. [nfotis: I think that would be a better idea to separate rendering and
  996.  reconstruction, as G.Ward does with Radiance]
  997.  
  998. o    Programmable reconstruction techniques, appropriate for any two-
  999.     dimensional signal, such as illumination spheres and screen images.
  1000.  
  1001. o    Programmable radiation patterns for light emitters.
  1002.  
  1003. o    Programmable cameras, selected by the user at run time.
  1004.  
  1005. o    Easily-extended object and meta-object classes.
  1006.  
  1007. o    Still and animated sequence rendering.
  1008.  
  1009. o    Any geometric object may be a light emitter.
  1010.  
  1011. o       Sampling and reconstruction are techniques unified across screen and
  1012.     object domains.  All sampling procedures are interchangeable, whether
  1013.     they are sampling the image plane, the illumination arriving at an
  1014.     object surface, the texture of a region, etc.  Similarly,
  1015.     reconstruction techniques, are equally, generic and applicable to all
  1016.     domains.  A sampler is simply considered a technique for gathering
  1017.     information on a two-dimensional distribution.  Callback procedures
  1018.     are used to control a sampler for the different purposes of screen
  1019.     sampling, shading, texturing, etc.
  1020.  
  1021. o       Shaders receive as input a description of the illumination sphere.
  1022.     They are not responsible for determining the incident illumination at
  1023.     a point, and they may reconstruct a sampled illumination signal before
  1024.     processing.
  1025.  
  1026. o       The incident illumination sphere is described as a collection of
  1027.     samples of the incident light.  Typically, one determines this sphere
  1028.     by first building a set of samples that are directed to light-emitting
  1029.     objects; they return the color of the light foud along the ray,
  1030.     whether it actually reached a light emitter or not.  Then this set may
  1031.     be passed to an adaptive sampler as a "seed", or starting signal.
  1032.     This increases the likelihood that light emitters are sampled, and
  1033.     allows the incident illumination sphere to be adaptively sampled until
  1034.     the sampled signal meets the criteria for that sampler.  This
  1035.     illumination sphere is then passed to a shader for modulation vy the
  1036.     bidirectional reflectance distribution function of the surface at this
  1037.     point.
  1038.  
  1039. o       Objects may be queried by a shader for information.  This contrasts
  1040.     with the Renderman model, where a shader may expect a number of
  1041.     variables to be precomputed and available.  Since the shaders in this
  1042.     system are not precompiled from a special-purpose language, if is
  1043.     difficult to determine a priori what information a shader requires
  1044.     from an object.  Thus each object contains a procedure that accepts a
  1045.     request from a shader in the form of a list of requested geometric
  1046.     values, and returns the relevant information.  There is a performance
  1047.     penalty for this process, but it only occurs once per shading point.
  1048.     I consider that the extra overhead to parse the request list is
  1049.     compensated by the time saved by not calculating unnecessary values.
  1050.  
  1051. o       Colors may be specified in a variety of formats, including spectral
  1052.     distributions.
  1053.  
  1054. o       Meta-objects (accelerators, CSG trees, abstract structures, etc.) are
  1055.     considered "first-class".
  1056.  
  1057. -------------------------------------------------------------------------------
  1058.  
  1059. Comments on the Glazing Trick, by Eric Haines (erich@eye.com)
  1060.  
  1061. Hans Kilian (iqkili@cbs.dk) writes:
  1062. >In vol. 5 issue 1, in 'The Glazing Trick' Haakan Andersson says that pumping
  1063. >up the specular exponent makes the shiny spot smaller and not sharper. If
  1064. >I'm not mistaken, this is because he uses point light sources and not area
  1065. >light sources. If he uses area lights he will get correct results. I'm sure
  1066. >that Haakan knows this, but I got the impression that he felt that this was
  1067. >Phong's fault, and it really isn't...
  1068.  
  1069. You're right in that part of the problem is that he's using point lights.
  1070. However, Phong's highlights are basically a way to simulate surface shininess.
  1071. After all, a true point light would never reflect (well, except at one single
  1072. point) in a surface if the surface was perfectly reflective, with no "spread"
  1073. in the reflection.  Essentially, Phong's trick is to spread out the reflected
  1074. light in a cosine to a power distribution, and note the value of this
  1075. distribution from the eye's view angle - a wider distribution gives a duller
  1076. looking surface.  When you have area lights, you can't use this easily:  you
  1077. either have to reflect the lights directly (in which case the lights are seen
  1078. in the reflection as if the surface were perfectly reflective) or you have to
  1079. sample the area a sufficient amount to get the phong highlights and sum and
  1080. scale these.
  1081.  
  1082. In theory, what works for lights should work for light reflectors in the
  1083. environment.  In other words, you could sample the environment (i.e.  ray
  1084. trace) from the view of the surface and use Phong highlighting on these sample
  1085. rays and so get a shiny or dull looking surface.  If you're smart, you'll
  1086. simply use the Phong distribution itself to determine where the rays are shot,
  1087. shooting more rays in the higher contribution areas.  This has been done, and
  1088. looks pretty good with enough reflection samples.
  1089.  
  1090. The problem with Phong's trick is that it is not energy conserving at all:  a
  1091. low cosine power gives a lot more total energy (light) reflected from a
  1092. surface than a high cosine power.  Phong kept peak intensity constant, which
  1093. is important for making it easy for a user to adjust the specular highlight's
  1094. look, but is lousy from any physically based standpoint.
  1095.  
  1096. This lack of energy conservation hit home when I tried doing texture mapping of
  1097. the cosine exponent.  Say you texture this exponent and it varies from 0 to 10.
  1098. The weird effect is that the surface brightness is brightest around 1 (or less,
  1099. if you allow < 1 exponents) and drops off as you go to 10.  So at 0 you get
  1100. no specular highlight, at 1 the overall brightness is at its height, then it
  1101. drops off as you go to 10.
  1102.  
  1103.  
  1104. >The thresholding trick is a neat trick, that I didn't know about, and it'll
  1105. >save a lot of rendering time when you *do* use point light sources and still
  1106. >want a large shiny spot on your objects.
  1107.  
  1108. Yes - essentially, you're saying you want the surface to look perfectly
  1109. reflective (i.e. mirrorlike, not like brushed aluminum) and for the light to
  1110. have a finite radius.  The only problem I see is that the thresholding trick
  1111. does not take into account the distance the object is from the light, so that
  1112. the light will always be reflected as the same relative size no matter what
  1113. the distance the light is from the object.
  1114.  
  1115. ======== Net cullings follow ==================================================
  1116.  
  1117. Graphics Gems IV Announcement, by Paul Heckbert (ph@cs.cmu.edu)
  1118.  
  1119. We've decided to bring out Gems IV in 1994, not 1993, to keep the quality of
  1120. the series high.  The deadline for contributions is in the late Spring of
  1121. 1993.  Write to Academic Press (not me) for more detailed information about
  1122. how to contribute:
  1123.  
  1124.     Graphics Gems Editor
  1125.     Academic Press
  1126.     955 Massachusetts Ave
  1127.     Cambridge MA 02139
  1128.  
  1129. or email jswetland@igc.org .
  1130.  
  1131. And if you've got ideas for contributions and you'd like to discuss their
  1132. appropriateness with me, email me at ph@cs.cmu.edu .  Suggestions and
  1133. criticisms of the previous volumes are also welcome.
  1134.  
  1135. -------------------------------------------------------------------------------
  1136.  
  1137. Announcing the ACM SIGGRAPH Online Bibliography Project, by Stephen Spencer
  1138.     (biblio@siggraph.org)
  1139.  
  1140. A new resource for researchers is now available to the computer graphics
  1141. community.  Over 15,000 unique bibliographic references from the computer
  1142. graphics field have been compiled into a single database for use by students,
  1143. researchers, and the computer community in general.
  1144.  
  1145. The project started with the DEC online computer graphics bibliography, which
  1146. covered the years 1976 through 1986, and added the contributed bibliographic
  1147. databases of a number of individuals, expanding the years covered as well as
  1148. the sources of information.
  1149.  
  1150. This database includes references from conferences and workshops worldwide and
  1151. from a variety of publications, from magazines and journals to books dating
  1152. back as far as the late 19th century.  The majority of the major journals and
  1153. conference proceedings between the mid-1970's and 1992 are listed here.
  1154.  
  1155. The database is formatted in the BibTeX bibliography entry format, an
  1156. easy-to-read and understand ASCII format.  It is organized into files by year
  1157. (except for the entries prior to 1975, which are collected into one file by
  1158. themselves).
  1159.  
  1160. A set of tools for manipulating and searching the bibliography database is
  1161. also available for downloading.
  1162.  
  1163. The database is available for anonymous FTP from "siggraph.org"
  1164. "(128.248.245.250)" in the "publications/bibliography" directory.  Use
  1165. "anonymous" as the username and your electronic mail address as the password
  1166. to gain entry to the FTP area on this machine.  Please download and examine
  1167. the file "READ_ME" contained in the "publications/bibliography" directory for
  1168. more specific information concerning the database.
  1169.  
  1170. This project is an ongoing concern:  We plan to expand the bibliography, both
  1171. keeping it up-to-date as well as filling in missing pieces, large or small,
  1172. and polishing and refining the format of the existing database.  In addition,
  1173. plans to provide interactive online searching of the database are underway.
  1174. Alternative distribution channels are also being considered.
  1175.  
  1176. Volunteers are always welcome.  Contact "biblio@siggraph.org" for more
  1177. information on what needs to be done.
  1178.  
  1179. Questions, corrections, suggestions, and contributions of material to the
  1180. database can be directed to:  "biblio@siggraph.org" on the Internet.
  1181.  
  1182. -------------------------------------------------------------------------------
  1183.  
  1184. A Brief History of Blobby Modeling, by Paul Heckbert (ph@cs.cmu.edu)
  1185.  
  1186. [I deleted the reference - if you want these, check the online SIGGRAPH
  1187. bibliography (see elsewhere in this issue for details). - EAH]
  1188.  
  1189. People have known for a long time that if you have two implicit surfaces
  1190. f(x,y,z)=0 and g(x,y,z)=0 that are fairly continuous, with a common sign
  1191. convention (f and g positive on the inside, negative on the outside, say) then
  1192. the implicit surface defined by f+g=0 is a blend of the shapes.  See [Ricci
  1193. 1983] for a variant of this.
  1194.  
  1195. The van der Waals surfaces of molecules (roughly speaking, iso-potentials of
  1196. the electron density) are described in Chemistry and Physics books and [Max
  1197. 1983].  To create animation of DNA for Carl Sagan's COSMOS TV Series, Jim
  1198. Blinn proposed approximating each atom by a Gaussian potential, and using
  1199. superposition of these potentials to define a surface.  He ray traced these
  1200. [Blinn 1982], and called them "blobby models".
  1201.  
  1202. Shortly thereafter, people at Osaka University and at Toyo Links in Japan
  1203. began using blobby models also.  They called theirs "metaballs" (or, when
  1204. misspelled, "meatballs").  Yoichiro Kawaguchi became a big user of their
  1205. software and their Links parallel processor machine to create his "Growth"
  1206. animations which have appeared in the SIGGRAPH film show over the years.  The
  1207. graduate students implementing the metaball software under Koichi Omura at
  1208. Osaka used a piecewise quadratic approximation to the Gaussian, however, for
  1209. faster ray-surface intersection testing (no need for iterative root finders;
  1210. you just solve a quadratic).  I don't know of any papers by the Japanese on
  1211. their blobby modeling work, which is too bad, because they have probably
  1212. pushed the technique further than anyone.
  1213.  
  1214. Bloomenthal has discussed techniques for modeling organic forms (trees,
  1215. leaves, arms) using blobby techniques [Bloomenthal 1991] (though he prefers
  1216. the term "implicit modeling") and for polygonizing these using adaptive,
  1217. surface-tracking octrees [Bloomenthal 1988].  The latter algorithm is not
  1218. limited to blobby models, but works for any implicit model, not just blobs.
  1219. Polygonization allows fast z-buffer renderers to be used instead of ray
  1220. tracers, for interactive previewing of shapes.  A less general variant of this
  1221. algorithm was described in the "marching cubes" paper by [Lorensen 87] and
  1222. some bugs in this paper have been discussed in the scientific visualization
  1223. community in the years since.  In the sci-vis community, people call them
  1224. "iso-surfaces" not "implicit surfaces".
  1225.  
  1226. Meanwhile, in Canada and New Zealand, the Wyvill brothers, and grad students,
  1227. were doing investigating many of the same ideas:  approximations of Gaussians,
  1228. animation, and other ideas.  See their papers listed below.  Rather than
  1229. "blobbies" or "metaballs", they called their creations "soft objects".  But
  1230. it's really the same idea.
  1231.  
  1232. Bloomenthal and Wyvill collected many good papers on blobby and implicit
  1233. modeling for a recent SIGGRAPH tutorial (1991?).
  1234.  
  1235. -------------------------------------------------------------------------------
  1236.  
  1237. Cool Raytracing Ideas, Karen Paik (paik@cgl.citri.edu.au)
  1238.  
  1239. Karen comments on:
  1240. >    In general removing "common sense" restraints from rendering equations
  1241. >gives you flexibility to do a lot of ad hoc effects.
  1242.  
  1243. At Compugraphics 92, M. Beigbeder and V. Bourgin presented a paper titled
  1244. "New Perspectives for Image Synthesis" in which they used artistic perspective
  1245. projections, instead of the usual one. They had a "fishbone" perspective and a
  1246. circular perspective. These perspectives broke a lot of the fundamental
  1247. assumptions. Straight lines weren't always straight after they were projected
  1248. and light didn't always travel in a straight line.
  1249.  
  1250. -------------------------------------------------------------------------------
  1251.  
  1252. Optical Effects and Accuracy, by Sam Uselton (uselton@wk207.nas.nasa.gov)
  1253.  
  1254. In article <1992Nov12.133317.5833@genes.icgeb.trieste.it> oberto@genes.icgeb.trieste.it (Jacques Oberto) writes:
  1255. >I am trying to reproduce one of Newton's experiments with POV.
  1256. >Would a simulated white light beam hitting a glass prism with the
  1257. >right angle be scattered into a rainbow spectrum ?
  1258. >Are POV and other ray-tracers optically accurate in that respect ?
  1259. >Has anybody tested the properties of 'raytraced' light other than
  1260. >reflection and refraction ?
  1261.  
  1262. I don't know POV................BUT
  1263.  
  1264. If it is in the tradition of the standard ray tracers, it starts at the eye,
  1265. shooting rays through pixels into a scene.  Essentially this is tracing ray
  1266. paths in reverse.  Generally speaking, ray paths are reversible, so this is
  1267. fine.  There are, however, difficulties.  When a ray hits an object, in
  1268. addition to reflected and refracted rays, rays to the light sources must be
  1269. generated to determine shadows, intensity of illumination, etc.  If one of
  1270. these light source rays hits a refractive object, it may no longer be headed
  1271. for the light source once the refraction is done.
  1272.  
  1273. What one would LIKE to do is shoot the light source ray in a direction (there
  1274. may be several correct choices) which will result in a ray pointed at the
  1275. light AFTER the refraction.  Guessing what direction(s) this might be is HARD.
  1276. One solution is to shoot lots of illumination rays in various directions
  1277. (especially from a surface that is not perfectly specular, use the BRDF as the
  1278. distribution being randomly sampled => distribution ("distributed") ray
  1279. tracing).
  1280.  
  1281. Another solution is to do the ray tracing from the light, but then most of the
  1282. rays won't get to the screen so the effort is wasted.  There are various
  1283. schemes in the literature for getting around the difficulties, but my guess is
  1284. that they are not in most public domain code.
  1285.  
  1286. Another difficulty probably ignored in most PD code, is that in order to break
  1287. out the spectrum, the refraction angle must be calculated on a wavelength
  1288. dependent basis, generally with a single ray turning into several rays to
  1289. properly sample the spectrum.
  1290.  
  1291. We (Redner, Lee & Uselton ++)have done an image of the experiment I believe
  1292. you are describing.  It was accepted into the SIGGRAPH slide set and
  1293. distributed last summer at the conference.  It does involve a forward ray
  1294. tracing phase, and some stuff to remember these results in a way that can be
  1295. used in a traditional backward ray tracer.  Harder than it looks.
  1296.  
  1297. [Also see Mitchell & Hanrahan's article in SIGGRAPH '92 about this topic. -EAH]
  1298.  
  1299. -------------------------------------------------------------------------------
  1300.  
  1301. Map Projections Reference Book, by Mike Goss (goss@CS.ColoState.EDU)
  1302.  
  1303. One of the best reference books for map projections is
  1304.     Map Projections --- A Working Manual
  1305.     by John P. Snyder
  1306.     USGS Professional Paper 1395
  1307.     US Gov't Printing Office, 1987 (383 pages)
  1308.  
  1309. It's available directly from USGS, and was $20 a few years ago.  In the USA,
  1310. call 1-800-USA-MAPS (1-800-872-6277) for ordering info.  Snyder covers all the
  1311. projections used by USGS, and a few others.  For each one he gives a bit of
  1312. history, some explanatory material, detailed formulas, and examples.
  1313.  
  1314. There is also some source code available for anonymous FTP at
  1315. spectrum.xerox.com, under directory /pub/map/source (I haven't used it, but
  1316. I've seen it there).
  1317.  
  1318. -------------------------------------------------------------------------------
  1319.  
  1320. A Brief Review of Playmation, by Chris Williams
  1321.     (chrisw@fciad2.bsd.uchicago.edu)
  1322.  
  1323.    Playmation is a good quality ray-tracer, and one of the few that renders
  1324. patches (Catmull-rom).  The base package only renders at 256 colors, but an
  1325. they offer a 24-bit DOS-based renderer for ~$100.00.  It's a very nice
  1326. renderer, and renders with an 8-bit alpha channel.  The major nice points of
  1327. the package are its modeler and animation capabilities.  I may review this
  1328. entire package in the future.
  1329.  
  1330.    BTW, Will Vinton has had nothing to do with the software other than lending
  1331. it his name.  The program has been in development on the Amiga for several
  1332. years as Animation Apprentice, then as Animation Journeyman.  It's still
  1333. available on the Amiga, and Mac and SGI versions are supposed to be in the
  1334. works.
  1335.  
  1336. [and in a later post:]
  1337.  
  1338.     If you are familiar with patch-based modeling, it is a fairly powerful
  1339. modeling interface.  It (IMHO) gives Alias a run for the money at a tiny
  1340. fraction of the cost.  I consider it the "poor person's Alias."
  1341.  
  1342. -------------------------------------------------------------------------------
  1343.  
  1344. PV3D Quick Review, by David Anjo <david.anjo@canrem.com>
  1345.  
  1346. I promised one individual on the net's that once I had received my registered
  1347. copy of PV3D I would post a general, brief review of what I have found.
  1348.  
  1349. First and foremost the most current version of PV3D is v.0.50.  I did download
  1350. it from The Graphics Alternative BBS (510 524-2165/2780) before I received my
  1351. copy in the mail.  I do not have ftp status from the mail site I use, so I
  1352. cannot suggest a location for those so inclined.  I would suspect that You Can
  1353. Call Me Ray BBS (708 358-8721/5611) will have a copy available of v.0.50.  I
  1354. mention this because YCCMR is a free access board, while TGA is subscriber
  1355. based.  I highly recommend *both* systems for anyone interested in PC based
  1356. raytracing.
  1357.  
  1358. The features included within the shareware version are identical to those in
  1359. the registered version, save the following:
  1360.  
  1361. - you can save a created scene file for future manipulation.
  1362.  
  1363. - the registered version includes two additional utilities, of which one I
  1364. have found to be most handy (a screen capture to texture map facility - very
  1365. nice).  *Source* code is included for both.
  1366.  
  1367. - larger screen previews of the online texture maps included with the product.
  1368. The preview screens certainly help in picking an appropriate texture for that
  1369. object, especially when you forget what the 'ell GRNT9 is supposed to look
  1370. like =].  As per the point above there are simple instructions on how to
  1371. incorporate your "designed" textures to this online library.
  1372.  
  1373. - a host of sample "triangled" DXF files - something I certainly appreciate
  1374. given the sweat I've had creating them.  Their integration is seamless, BTW.
  1375.  
  1376. For those who do not know what PV3D is, here's a brief review.
  1377.  
  1378. PV3D is a wireframe modeler for those PC based raytracers using Persistence of
  1379. Vision.  It is something more oriented towards the novice PoV user and for
  1380. even the advanced, experienced souls, who just want to get on with creating
  1381. (hopefully) interesting raytraced artworks.  Beyond providing the basic
  1382. primitives (sphere, quad sphere, cylinders, cones, cubes, pyramids, positive
  1383. and negative blobs, planes and torii) PV3D can also generate spline based
  1384. objects.  You can incorporate "triangled" DXF files.  Multiple lights can be
  1385. positioned, as well as the look_at and camera locations, very easily.  You can
  1386. preview the textures used and the colours applied (corresponding surface
  1387. "highlights") to individual objects.  It is reasonably priced (250 Frebch
  1388. Francs) and although still in a beta stage, extremely promising.  It has cut
  1389. down my "code" time dramatically, increasing my creative time ten fold.  I'm a
  1390. computer based artist and the goal is to produce art - PV3D is a major benefit
  1391. in that pursuit.
  1392.  
  1393. Back to the latest version...
  1394.  
  1395. The biggest change in v.0.50 as far as I'm concerned is the new View 3D
  1396. option.  This will give you a world view of your scene from the perspective of
  1397. the camera location.  This is a major advantage, especially when you get up
  1398. close to the maximum of 150 objects and you are, quite simply, lost.  I know,
  1399. I certainly have been in the past =].  Very nice addition.
  1400.  
  1401. The documentation is still hurting from a lack of a suitable French to English
  1402. translation, but I intend to offer my assistance in that regard.  Mind you if
  1403. the author's English is bad, my French is a lot worse.  I will be seeking a
  1404. good translation program in this effort - any suggestions for a bi-directional
  1405. program would be much appreciated.
  1406.  
  1407. [unfortunately, I didn't receive the second part of the review at our site,
  1408. so this is all there is! - EAH]
  1409.  
  1410. -------------------------------------------------------------------------------
  1411.  
  1412. Bounding Volumes (Sphere vs. Box), by Tom Wilson (wilson@cs.ucf.edu)
  1413.  
  1414. [For those learning about the value of bounding volumes, here's a summary.
  1415. - EAH]
  1416.  
  1417. djb@geovision.gvc.com (Darren Burns) wrote:
  1418. >I had been under the impression that it was quicker to intersect
  1419. >a line with a sphere than with a box.  I just did a timing test.
  1420. >Basically I had a bunch of spheres or boxes sitting there and I
  1421. >ray-traced the scene, once using spheres and once using boxes.
  1422. >I found that the boxes were faster (not a lot, 11 seconds for
  1423. >spheres vs 9 for boxes).  The volumes were about the same for
  1424. >both types of objects; actually the spheres were a little smaller.
  1425.  
  1426. You must be careful when drawing your conclusion.  I've found 3D boxes faster
  1427. too, but it is very dependent upon what's inside as to whether or not it will
  1428. be.  Depending on how optimized your code is, the sphere BV may be faster to
  1429. intersect with a ray, but the comparison doesn't end there.  When a ray hits
  1430. an object inside the BV, both the sphere and the box are a waste of time.
  1431. When the object inside the BV is missed, it is up to the BV to cull as many
  1432. rays as possible.  You want to perform the ray-object intersection code as few
  1433. times as possible when it will miss the object (you obviously must execute the
  1434. code when there is a hit).
  1435.  
  1436. Also you must take into account the relative execution times of (1) ray-sphere
  1437. (as BV) int., (2) ray-box int., and (3) ray-object int.  If (3) is much
  1438. greater than both (1) and (2), you may get a better answer from your test.
  1439. Suppose you have 2 BVs:  BV #1 is the slower of the two, but culls more
  1440. misses, BV #2 is the faster of the two, but culls fewer misses.  Which is
  1441. better?  That depends on how many rays are actually involved in the
  1442. comparison, but let's be sloppy and just say:  if the time saved by using the
  1443. faster BV #2 is lost by executing the slower ray-object routine more times, BV
  1444. #1 may actually be the better choice.  Too many tests involve spheres or boxes
  1445. around simple triangles.
  1446.  
  1447. Basically, you are introducing yourself to an old, but difficult-to-fully-
  1448. -solve problem.  Much work has been done on the choice of BVs.  Couple that
  1449. with a construction of a hierarchy of BVs and you really have a mess.  Find
  1450. some of the bibliographies at ftp sites to see the work that has already been
  1451. done (also you might find my collection of ray tracing abstracts which might
  1452. give you a clue about what is discussed before you actively seek the papers --
  1453. send me e-mail for more details if you'd like, I don't want to bother at the
  1454. moment).  The text _An Introduction to Ray Tracing_ has a sufficient
  1455. explanation of the background material.
  1456.  
  1457. The only strong conclusion I can make is that boxes work best for the scene(s)
  1458. you tested.  They may be a good choice in general, but that's a dangerous
  1459. statement.
  1460.  
  1461. I hope I made some helpful comments. Others are appreciated.
  1462.  
  1463. [Me, I've given up bounding volume spheres and even ellipsoids:  boxes seem to
  1464. almost always have tighter bounds and having only one bounding volume
  1465. throughout your program saves a lot of messing around in the code.  - EAH]
  1466.  
  1467. -------------------------------------------------------------------------------
  1468.  
  1469. Raytracing Swept Objects, by Mark Podlipec (podlipec@dgxyris.webo.dg.com)
  1470.  
  1471. In article <BAGCHI.92Sep22220950@quip.eecs.umich.edu>, bagchi@eecs.umich.edu (Ranjan Drzzzzt!  Bagchi) writes:
  1472. |>
  1473. |>     Consider this object:  I take a curve between two endpoints, and rotate
  1474. |> it 360 degrees about the y axis.  How would I go about ray-tracing the solid
  1475. |> I've just swept out.
  1476. |>
  1477. |>     I've given this some thought.. and I'm fairly sure that in
  1478. |> the general case, this is quite difficult.  But are there any classes
  1479. |> of curves which sweep out solids which are easy to get
  1480. |> ray-intersections and surface normals?
  1481.  
  1482. I've implemented an object for rayshade a couple of years ago which is pretty
  1483. similar to what you've described(I call it cubicspin).  You take any curve
  1484. described by a 3rd degree polynomial and rotate it about an arbitrary axis.
  1485. End points are also specified.
  1486.  
  1487. A third degree polynomial rotated like that becomes a 6th degree polynomial
  1488. and then you can substitute in the ray equations to find the point of
  1489. intersection.  Throw in some checking for the end points and there ya go.
  1490. This is the brute force method.
  1491.  
  1492. I use natural cubic splines to specify the curve.
  1493.  
  1494. Now if you started with a 4th degree curve, you would have to solve 8th degree
  1495. equations, etc.  But for the most uses, the extra degrees don't buy you much.
  1496.  
  1497. [My favorite article on this topic is still:
  1498.     %A Jarke J. van Wijk
  1499.     %T Ray Tracing Objects Defined by Sweeping Planar Cubic Splines
  1500.     %J ACM Trans. on Graphics
  1501.     %V 3
  1502.     %N 3
  1503.     %D July 1984
  1504.     %P 223-37
  1505. - EAH]
  1506.  
  1507. -------------------------------------------------------------------------------
  1508.  
  1509. Ray Transformation, by Kendall Bennett (rcskb@minyos.xx.rmit.oz.au)
  1510.  
  1511. [an article for people trying to implement the viewing transform. - EAH]
  1512.  
  1513. >belme@waterloo.hp.com (Frank Belme) writes:
  1514. >
  1515. >I was wondering what a good way is to calculate the direction of each ray
  1516. >for ray tracing a scene given an eyepoint, eye direction, and field of view
  1517. >angle.  Any help would be appreciated.  Thanks.
  1518.  
  1519. There is actually a better way of doing this, that can take into account
  1520. aspect ratio and fields of view prior to actually computing the ray direction
  1521. (the speedup in this routine are generally not that noticeable, but it is nice
  1522. to have something elegant!).
  1523.  
  1524. The first step is to compute two vectors, one in the direction of increasing x
  1525. coordinates for the image, and one for increasing y coords, that are scaled to
  1526. be the length of a pixel in each respective direction (aspect ratio calcs go
  1527. in here).  Then compute a vector that points towards the upper left corner of
  1528. the screen (I will give pseudo code later).
  1529.  
  1530. When you have this information, you can quickly create any ray to fire by
  1531. simply adding appropriately scaled versions of the x and y direction vectors
  1532. to the vector pointing to the first pixel (of course you want to normalise the
  1533. final vector :-):
  1534.  
  1535. PreProcessing stage:
  1536.  
  1537.     xdir = (2 * lookDistance * tan(hfov / 2)) / xres
  1538.     ydir = (2 * lookDistance * tan(vfov / 2)) / yres
  1539.  
  1540.     ydir *= aspect // Adjust y pixel size given aspect ratio
  1541.  
  1542.     LLdir = camera.dir - (xdir * xres)/2 - (ydir * yres)/2
  1543.  
  1544. Computing the ray to fire:
  1545.  
  1546.     dir = LLdir + xdir * x + ydir * y
  1547.     dir = dir normalised
  1548.  
  1549. and you are done - not rotations, just simply vector additions and scales
  1550. (this is almost directly taken from my C++ ray tracer).
  1551.  
  1552. -------------------------------------------------------------------------------
  1553. END OF RTNEWS
  1554.